home *** CD-ROM | disk | FTP | other *** search
- sort.doc sort Version 1.49 by Rüdiger Werner
-
- The program and files in this distribution are freely distributable.
- No commercial usage is permitted without written permission from the
- author. Everything in this distribution must be kept together, in original
- unmodified form.
-
- *************************
-
- ***********************************************************************
- * Notice that the author can't be made responsible for the destroying *
- * or lost of data through use of this program. You use it on your own *
- * risc. Please read carefully the Doc-file before using. *
- ***********************************************************************
-
-
- This copy is not registered.
- For registration send a letter with 5 US$ or its EQUIVALENT in DM to the
- below mentioned address. If you give an e-mail address, you will get the
- registered version via this medium. Otherwise include an addressed and
- franked envelope (2 DM within Germany) or 3 more US$ for shipping.
- Send cash only, for checks add 6 US$ for the charges of the bank.
-
- *************************
-
- Please contact me if you have any comments or suggestions:
-
- E-Mail: rw2@irz.inf.tu-dresden.de
- wernerr@iee1.et.tu-dresden.de
-
- URL: http://home.pages.de/~wernerr
- http://www.inf.tu-dresden.de/~rw2
- http://eeetw0.et.tu-dresden.de:8080/~wernerr
-
- Snail
- Mail: Rüdiger Werner
- Stresemannplatz 2
- 01309 Dresden
- GERMANY
-
-
- CHANGES TO LAST VERSIONS
-
- (1.48)
- -q option added
- -Q option added
-
- (1.47)
- removed a bug which could occur, if binary characters in the file
- no maximun length of a line for AMIGA version anymore
-
- (1.46)
- loading speed increased
- sorting time reduced downto 5 per cent or less
- no (recognizable) time is needed anymore for freeing the memory
- -c option changed
- -C option added
- -i option added
- -S option added
- -v option added
-
- Description
- -----------
-
- The program was written for use in Shell only.
- It is started either by simply typing it's name (of course it should be
- in the current directory or in the path) or by giving additionally switches
- and/or the name of the file what should be sorted.
-
- sort [switches] infile [infile 2 ... ] [outfile]
-
- By typing 'sort ?' appears a short help.
- The specified file is opened and red into the memory. There it will be
- sorted and, if any switches were set, manipulated in the required way.
-
- Explanation of the switches (alphabeticially order):
-
- NOTE: In the unregistered version only the -a, -e and -g switches are working.
- ------------------------------------------------------------------------------
-
- -a sorting the file in ascending order (it is optional, because default)
-
- -c[z,l] with this option the number 'z' of column can be specified, by which
- the file is to be sorted. 'l' specifies, how many chars are used for
- sorting.
- This is useful e.g. to sort the RECENT files from Aminet by type.
- (-c20,10)
- If double lines are erased, the comparision starts at the FIRST char
- of the lines, means the whole line is used for comparision.
- If 'l' is not given, it will be asked for, if 'l' given as '0' it
- will be set automatical to maximum line length
-
- -C[z,l] see above
- The difference is, that the comparision for erasing double
- lines starts at the column, which is specified for sorting.
- comparision is made till end of the line, the number of chars
- for sorting doesn't have any influence.
-
- -d sorting the file in descending order
-
- -e all empty lines will be erased.
-
- -E all empty lines and all identical lines in the file will be erased
- after sorting (of course ONE of these lines is kept in the file).
-
- -f[y] using this option the first line of the work range can be specified
- If this option is given, ALL actions are done ONLY within this range.
- To give also the last line is not compelling.
- If y is bigger than the number of lines of the internal file
- (all in-read files together) an error-message appears and the
- program is cancelled.
-
- -g actually the capitals and small letters are distinguished.
- by setting this switch, they won't be distinguished.
-
- -i[str] the given string is ignored for sorting, if it appears
- on the beginning of the sorting column. It's NOT removed!
- if spaces are in the string, it's advicable to give the -i
- option only in the command line and answer the request.
- For deleting the full line is used for comparision.
-
- -j[x] joins x files and sorts them; the resulting file will be
- written to <outfile>.
-
- -J[x] joins x files without sorting; the resulting file will be
- written to <outfile>.
-
- -l[y] using this option the first line of the work range can be specified
- If this option is given, ALL actions are done ONLY within this range.
- To give also the first line is not compelling.
- if y is bigger than the number of lines of the internal file
- (all in-read files together) the last line of the file is
- automatically taken as last line of the range.
-
- if x or/and y is not given it will be asked for
-
- -n the file is not sorted, only empty lines are erased.
-
- -N the file is not sorted, only empty lines and identical lines which
- are side by side are erased (of course ONE line is kept in the file).
- Note that it might more useful if the file is already sorted.
-
- -o the specified file for reading will be overwritten by the sorted
- file.
- BE CAREFUL!!! IF ONCE OVERWRITTEN THE ORIGINAL FILE CAN'T BE RESTORED!!!
-
- -p[str] all lines, which do not match the search pattern 'str' will be removed.
- note: if characters like " are given it is advisable to give
- this switch as the very last of the command line. The reason is that
- the following arguments are not recognized after a " by the programm.
-
- -P[str] all lines, which match the search pattern str will be removed
- note: see -p
-
- -q[str] divide a file.
- All lines which do not match the search pattern will be written to
- an extra file (<outfile>.ohne) and all lines, which don't to
- anotherone.
- note: see -p
-
- -Q[str] divide a file.
- All lines which do match the search pattern will be written to a
- file (<outfile>.mit) and all lines, which don't to anotherone.
- note: see -p
-
- NOTE:
- The use of -p|P and -q|Q is possible at the same time. Then the
- lines will be picked out / throwed out according to the string
- given with the -p|P option, and AFTER sorting, the file will be
- divided into two according to the string given with the -q|Q switch.
-
-
- -r the file which was red will only be written in reverse order of lines
- without any other actions
-
- -s[c] with this option the character c will be removed from the file/range.
- note: if characters like " need to be removed it is advisable to give
- this switch as the very last of the command line. The reason is that
- the following arguments are not recognized after a " by the programm.
-
- -S[cd] with this option the char c will be replaced by char d in the
- file/range.
- note: see -s[c]
-
- -v this option supresses all messages, including the warning, that the
- outfile already exists.
- Only error messages will appear.
-
- -x the sorting function will be disabled
-
-
- some examples:
-
- sort textfile1
- asks for the outfilename and loads textfile1. After sorting it will be
- written to outfile
-
- sort textfile1 text.out -g
- loads textfile1 without distinguishing capitals and small letters and
- writes the sorted file to text.out
-
- sort textfile1 textfile2 -j3 textfile3 ram:text.out -E
- loads textfile1 textfile2 and textfile3 sorts, removes all empty lines
- and all identical lines (except of one of them) and writes the
- list to RAM:text.out
-
- sort RECENT RECENT.sort -E -c20,10 -g -f6
- is the common command line to sort the RECENT files from Aminet
- sorting starts at line 6, means the header is not touched
- it is sorted after the types of the files, additionally the entries
- are sorted after the first column
- empty lines and identical lines are deleted
- (the whole line is used for comparision)
-
- sort RECENT ram:file1 -g -E -c20,10 -pdev/ -q/e
- sorts the Aminet RECENT file by the type of program, erases all lines
- which don't contain 'dev/' and divides the remaining file into one, which
- lines contain the string '/e' (written to ram:file1) and one, which lines
- doesn't contain the string '/e' (written to ram:file1.ohne)
-
- sort file1 -j3 file2 file3 ram:big_file -px -qy -E -g
- loads file1, file2 and file3, picks out all lines which contain the
- string 'x' (means delete all lines which doesn't contain it), sorts the
- file without distinguishing capitals and small letters, deletes all double
- lines. After that all lines which don't contain the string 'y' will be
- written to ram:big_file.ohne, the rest to ram:big_file.
-
-
- ******
-
- The switches can be set at any place after the program name.
- If the parameter to the switch is not given, it will be asked for.
- The program detects contradictions between given switches to avoid possible
- mistakes from the user
-
- Notice that the outfilename has to be the last of all filenames.
- If no outfilename is given, the first infilename plus a new ending is used
- for a suggestion for the outfilename.
-
- The sort-order bases on the strcmp/stricmp function.
-
- The maximum length of a line in a file is 1024 byte.
- All bytes that a line is longer than this are cutted. A message appears in
- this case. If you need to sort longer lines, just send me a mail.
-
- The size of the file to be sorted depends only on the size of the available
- memory (and on your patience). The used time is shown after sorting, just
- for your statistics ...
- The sort_engl file is the same as the sort file, just all messages appear
- in English.
-
- I'd be grateful for any comments, suggestions and bug reports.
-
-
- Rüdiger Werner
-